package com.leyou.item.mapper;

import com.leyou.item.pojo.Category;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author CHERRY
 * @date 2018-09-01-15:14
 */
@Repository
public interface CategoryMapper extends Mapper<Category>,SelectByIdListMapper<Category,Long> {
    /**
     * 根据品牌Id查询所属分类信息
     *
     * @param bid
     * @return
     */
    @Select("SELECT *FROM tb_category WHERE id IN (SELECT category_id FROM tb_category_brand WHERE brand_id = #{bid})")
    List<Category> selectBrandCategoryByBid(Long bid);
}
